var printWarehouseOrderTemplateMixin = function () {
  return {
    data: function () {
      return {
        templateType: ''
      }
    },

    methods: {
      print: function () {
        var printData = this.printData;
        if (printData.length === 0) {
          return;
        }

        var data = _.uniqBy(printData, 'warehouseTypeText');
        if (data.length > 1) {
          this.$alert('所选择的记录不是同一出入库类型数据，不能打印', '信息');
          return;
        }

        data = _.uniqBy(printData, 'customerName');
        if (data.length > 1) {
          this.$alert('所选择的记录不是同一个客户，不能打印', '信息');
          return;
        }

        var type = data[0].warehouseTypeText;
        var self = this;
        this.toPreviewTemplateOrder(function () {
          var templateType = type === '出库' ? 'out' : 'in';
          self.templateType = templateType;
        }, type);
      }
    }
  };
}();
